
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.1对象、类对象、元类对象 · zhoufei-iosknowledges</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhoufei">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="3.2.html" />
    
    
    <link rel="prev" href="3.html" />
    

    
        <link rel="shortcut icon" href='../../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../../source/images/apple-touch-icon.jpg">
        
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"zhou415770319","repo":"iosKnowledges","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.feiyum.cn/index/" target="_blank" class="custom-link">我的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    iOS面试题总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../ui/ui.html">
            
                <a href="../ui/ui.html">
            
                    
                    1、UI视图相关面试题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../ui/UITableview.html">
            
                <a href="../ui/UITableview.html">
            
                    
                    1.1UITableview相关面试题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../ui/shujutongbu.html">
            
                <a href="../ui/shujutongbu.html">
            
                    
                    1.2数据源同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../ui/shijianchuandi.html">
            
                <a href="../ui/shijianchuandi.html">
            
                    
                    1.3UI事件传递与响应
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../ui/tuxiangxianshi.html">
            
                <a href="../ui/tuxiangxianshi.html">
            
                    
                    1.4UI图像显示原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../ui/kadundiaozheng.html">
            
                <a href="../ui/kadundiaozheng.html">
            
                    
                    1.5UI卡顿掉帧原因
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../ui/yibuhuizhi.html">
            
                <a href="../ui/yibuhuizhi.html">
            
                    
                    1.6异步绘制原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../ui/lipingxuanran.html">
            
                <a href="../ui/lipingxuanran.html">
            
                    
                    1.7离屏渲染
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../oc/2.html">
            
                <a href="../oc/2.html">
            
                    
                    2、OC语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../oc/2.1.html">
            
                <a href="../oc/2.1.html">
            
                    
                    2.1OC相关面试题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../oc/2.2.html">
            
                <a href="../oc/2.2.html">
            
                    
                    2.2分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../oc/2_4.html">
            
                <a href="../oc/2_4.html">
            
                    
                    2.4扩展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../oc/2.5.html">
            
                <a href="../oc/2.5.html">
            
                    
                    2.5代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../oc/2.6.html">
            
                <a href="../oc/2.6.html">
            
                    
                    2.6通知
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../oc/2.7.html">
            
                <a href="../oc/2.7.html">
            
                    
                    2.7KVO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../oc/2.8.html">
            
                <a href="../oc/2.8.html">
            
                    
                    2.8KVC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../oc/2.9.html">
            
                <a href="../oc/2.9.html">
            
                    
                    2.9属性关键字
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="3.html">
            
                <a href="3.html">
            
                    
                    3、Runtime
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.1" data-path="3.1.html">
            
                <a href="3.1.html">
            
                    
                    3.1对象、类对象、元类对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="3.2.html">
            
                <a href="3.2.html">
            
                    
                    3.2消息传递机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="3.3.html">
            
                <a href="3.3.html">
            
                    
                    3.3消息转发流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="3.4.html">
            
                <a href="3.4.html">
            
                    
                    3.4Method-Swizzling
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../neicun/4.html">
            
                <a href="../neicun/4.html">
            
                    
                    4、内存
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../neicun/4.1.html">
            
                <a href="../neicun/4.1.html">
            
                    
                    4.1引用计数表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../neicun/4.2.html">
            
                <a href="../neicun/4.2.html">
            
                    
                    4.2弱引用表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../neicun/4.3.html">
            
                <a href="../neicun/4.3.html">
            
                    
                    4.3ARC、MRC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../neicun/4.4.html">
            
                <a href="../neicun/4.4.html">
            
                    
                    4.4循环引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../neicun/4.5.html">
            
                <a href="../neicun/4.5.html">
            
                    
                    4.5内存管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../block/5.html">
            
                <a href="../block/5.html">
            
                    
                    5、Block
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../block/5.1.html">
            
                <a href="../block/5.1.html">
            
                    
                    5.1Block本质
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../block/5.2.html">
            
                <a href="../block/5.2.html">
            
                    
                    5.2截获变量特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../block/5.3.html">
            
                <a href="../block/5.3.html">
            
                    
                    5.3内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../block/5.4.html">
            
                <a href="../block/5.4.html">
            
                    
                    5.4循环引用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../duoxiancheng/6.html">
            
                <a href="../duoxiancheng/6.html">
            
                    
                    6、多线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../duoxiancheng/6.1.html">
            
                <a href="../duoxiancheng/6.1.html">
            
                    
                    6.1GCD、nsoperation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../duoxiancheng/6.2.html">
            
                <a href="../duoxiancheng/6.2.html">
            
                    
                    6.2资源共享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../duoxiancheng/6.3.html">
            
                <a href="../duoxiancheng/6.3.html">
            
                    
                    6.3线程同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../duoxiancheng/6.4.html">
            
                <a href="../duoxiancheng/6.4.html">
            
                    
                    6.4SpinLock等
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../runloop/7.md">
            
                <span>
            
                    
                    7、RunLoop
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../runloop/7.1.md">
            
                <span>
            
                    
                    7.1事件循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../runloop/7.2.md">
            
                <span>
            
                    
                    7.2用户态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../runloop/7.3.md">
            
                <span>
            
                    
                    7.3核心态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../runloop/7.4.md">
            
                <span>
            
                    
                    7.4常驻线程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../network/8.md">
            
                <span>
            
                    
                    8、网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../network/8.1.md">
            
                <span>
            
                    
                    8.1HTTPS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../network/8.2.md">
            
                <span>
            
                    
                    8.2对称加密算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../network/8.3.md">
            
                <span>
            
                    
                    8.3非对称加密
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../network/8.4.md">
            
                <span>
            
                    
                    8.4DNS解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../network/8.5.md">
            
                <span>
            
                    
                    8.5HTTP、TCP
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >3.1对象、类对象、元类对象</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><b></b>&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;</a></li><ul><li><span class="title-icon "></span><a href="#&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;"><b></b>&#x683C;&#x7269;&#x81F4;&#x77E5;iOS&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;</a></li><li><span class="title-icon "></span><a href="#&#x7C7B;&#x5BF9;&#x8C61;"><b></b>&#x7C7B;&#x5BF9;&#x8C61;</a></li><li><span class="title-icon "></span><a href="#&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;"><b></b>&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;</a></li><li><span class="title-icon "></span><a href="#&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><b></b>&#x5143;&#x7C7B;&#x5BF9;&#x8C61;</a></li></ul></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h2 id="&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><a name="&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;" class="plugin-anchor" href="#&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5BF9;&#x8C61;&#x3001;&#x7C7B;&#x5BF9;&#x8C61;&#x3001;&#x5143;&#x7C7B;&#x5BF9;&#x8C61;</h2>
<h3 id="&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;"><a name="&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;" class="plugin-anchor" href="#&#x683C;&#x7269;&#x81F4;&#x77E5;ios&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a href="https://www.jianshu.com/p/0ba0b2bac78a" title="&#x683C;&#x7269;&#x81F4;&#x77E5;iOS&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;" target="_blank">&#x683C;&#x7269;&#x81F4;&#x77E5;iOS&#x7C7B;&#x4E0E;&#x5BF9;&#x8C61;</a></h3>
<h3 id="&#x7C7B;&#x5BF9;&#x8C61;"><a name="&#x7C7B;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x7C7B;&#x5BF9;&#x8C61;" class="plugin-anchor" href="#&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7C7B;&#x5BF9;&#x8C61;</h3>
<p>&#x7C7B;&#x5BF9;&#x8C61;(Class)&#x662F;&#x7531;&#x7A0B;&#x5E8F;&#x5458;&#x5B9A;&#x4E49;&#x5E76;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x7531;&#x7F16;&#x8BD1;&#x5668;&#x521B;&#x5EFA;&#x7684;&#xFF0C;&#x5B83;&#x6CA1;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x5B9E;&#x4F8B;&#x53D8;&#x91CF;&#xFF0C;&#x8FD9;&#x91CC;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x548C;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x5217;&#x8868;&#x662F;&#x5C5E;&#x4E8E;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x7684;&#xFF0C;&#x4F46;&#x5176;&#x5B58;&#x50A8;&#x4E8E;&#x7C7B;&#x5BF9;&#x8C61;&#x5F53;&#x4E2D;&#x7684;&#x3002;&#x6211;&#x4EEC;&#x5728;<code>/usr/include/objc/objc.h</code>&#x4E0B;&#x770B;&#x770B;<code>Class</code>&#x7684;&#x5B9A;&#x4E49;:</p>
<pre><code>/// An opaque type that represents an Objective-C class.
typedef struct objc_class *Class;
</code></pre><p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x7C7B;&#x662F;&#x7531;<code>Class</code>&#x7C7B;&#x578B;&#x6765;&#x8868;&#x793A;&#x7684;&#xFF0C;&#x5B83;&#x662F;&#x4E00;&#x4E2A;<code>objc_class</code>&#x7ED3;&#x6784;&#x7C7B;&#x578B;&#x7684;&#x6307;&#x9488;&#x3002;&#x6211;&#x4EEC;&#x63A5;&#x7740;&#x6765;&#x770B;<code>objc_class</code>&#x7ED3;&#x6784;&#x4F53;&#x7684;&#x5B9A;&#x4E49;:</p>
<pre><code>struct objc_class {
    Class                      isa;           // &#x6307;&#x5411;&#x6240;&#x5C5E;&#x7C7B;&#x7684;&#x6307;&#x9488;(_Nonnull)
    Class                      super_class;   // &#x7236;&#x7C7B;                  
    const char                *name;          // &#x7C7B;&#x540D;(_Nonnull)
    long                       version;       // &#x7C7B;&#x7684;&#x7248;&#x672C;&#x4FE1;&#x606F;(&#x9ED8;&#x8BA4;&#x4E3A;0)
    long                       info;          // &#x7C7B;&#x4FE1;&#x606F;(&#x4F9B;&#x8FD0;&#x884C;&#x671F;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x4F4D;&#x6807;&#x8BC6;)
    long                       instance_size; // &#x8BE5;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x53D8;&#x91CF;&#x5927;&#x5C0F;
    struct objc_ivar_list     *ivars;         // &#x8BE5;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x94FE;&#x8868;
    struct objc_method_list * *methodLists;   // &#x65B9;&#x6CD5;&#x5B9A;&#x4E49;&#x7684;&#x94FE;&#x8868;
    struct objc_cache         *cache;         // &#x65B9;&#x6CD5;&#x7F13;&#x5B58;
    struct objc_protocol_list *protocols;     // &#x534F;&#x8BAE;&#x94FE;&#x8868;
};
</code></pre><ul>
<li>isa&#x6307;&#x9488;&#x662F;&#x548C;<code>Class</code>&#x540C;&#x7C7B;&#x578B;&#x7684;<code>objc_class</code>&#x7ED3;&#x6784;&#x6307;&#x9488;&#xFF0C;&#x7C7B;&#x5BF9;&#x8C61;&#x7684;&#x6307;&#x9488;&#x6307;&#x5411;&#x5176;&#x6240;&#x5C5E;&#x7684;&#x7C7B;&#xFF0C;&#x5373;&#x5143;&#x7C7B;&#x3002;&#x5143;&#x7C7B;&#x4E2D;&#x5B58;&#x50A8;&#x7740;&#x7C7B;&#x5BF9;&#x8C61;&#x7684;&#x7C7B;&#x65B9;&#x6CD5;&#xFF0C;&#x5F53;&#x8BBF;&#x95EE;&#x67D0;&#x4E2A;&#x7C7B;&#x7684;&#x7C7B;&#x65B9;&#x6CD5;&#x65F6;&#x4F1A;&#x901A;&#x8FC7;&#x8BE5;isa&#x6307;&#x9488;&#x4ECE;&#x5143;&#x7C7B;&#x4E2D;&#x5BFB;&#x627E;&#x65B9;&#x6CD5;&#x5BF9;&#x5E94;&#x7684;&#x51FD;&#x6570;&#x6307;&#x9488;</li>
<li>super_class&#x4E3A;&#x8BE5;&#x7C7B;&#x6240;&#x7EE7;&#x627F;&#x7684;&#x7236;&#x7C7B;&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&#x679C;&#x8BE5;&#x7C7B;&#x5DF2;&#x7ECF;&#x662F;&#x6700;&#x9876;&#x5C42;&#x7684;&#x6839;&#x7C7B;(&#x5982;<code>NSObject</code>&#x6216;<code>NSProxy</code>), &#x5219; super_class&#x4E3A;<code>NULL</code></li>
<li>ivars&#x662F;&#x4E00;&#x4E2A;&#x6307;&#x5411;<code>objc_ivar_list</code>&#x7C7B;&#x578B;&#x7684;&#x6307;&#x9488;&#xFF0C;&#x7528;&#x6765;&#x5B58;&#x50A8;&#x6BCF;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#x53D8;&#x91CF;&#x7684;&#x5730;&#x5740;</li>
<li>info&#x4E3A;&#x8FD0;&#x884C;&#x671F;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x4F4D;&#x6807;&#x8BC6;&#xFF0C;&#x6BD4;&#x5982;:
 <code>CLS_CLASS (0x1L)</code>&#x8868;&#x793A;&#x8BE5;&#x7C7B;&#x4E3A;&#x666E;&#x901A;&#x7C7B;, <code>CLS_META (0x2L)</code>&#x5219;&#x8868;&#x793A;&#x8BE5;&#x7C7B;&#x4E3A;&#x5143;&#x7C7B;</li>
<li>methodLists&#x7528;&#x6765;&#x5B58;&#x653E;&#x65B9;&#x6CD5;&#x5217;&#x8868;&#xFF0C;&#x6839;&#x636E;info&#x4E2D;&#x7684;&#x6807;&#x8BC6;&#x4FE1;&#x606F;&#xFF0C;&#x5F53;&#x8BE5;&#x7C7B;&#x4E3A;&#x666E;&#x901A;&#x7C7B;&#x65F6;&#xFF0C;&#x5B58;&#x50A8;&#x7684;&#x65B9;&#x6CD5;&#x4E3A;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF1B;&#x5982;&#x679C;&#x662F;&#x5143;&#x7C7B;&#x5219;&#x5B58;&#x50A8;&#x7684;&#x7C7B;&#x65B9;&#x6CD5;</li>
<li>cache&#x7528;&#x4E8E;&#x7F13;&#x5B58;&#x6700;&#x8FD1;&#x4F7F;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x7CFB;&#x7EDF;&#x5728;&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#x65F6;&#x4F1A;&#x5148;&#x53BB;cache&#x4E2D;&#x67E5;&#x627E;&#xFF0C;&#x5728;&#x6CA1;&#x6709;&#x67E5;&#x627E;&#x5230;&#x65F6;&#x624D;&#x4F1A;&#x53BB;methodLists&#x4E2D;&#x904D;&#x5386;&#x83B7;&#x53D6;&#x9700;&#x8981;&#x7684;&#x65B9;&#x6CD5;</li>
</ul>
<h3 id="&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;"><a name="&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;" class="plugin-anchor" href="#&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;</h3>
<p>&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x662F;&#x6211;&#x4EEC;&#x5BF9;&#x7C7B;&#x5BF9;&#x8C61;<code>alloc</code>&#x6216;&#x8005;<code>new</code>&#x64CD;&#x4F5C;&#x65F6;&#x6240;&#x521B;&#x5EFA;&#x7684;&#xFF0C;&#x5728;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#x4E2D;&#x4F1A;&#x62F7;&#x8D1D;&#x5B9E;&#x4F8B;&#x6240;&#x5C5E;&#x7684;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x53D8;&#x91CF;&#xFF0C;&#x4F46;&#x5E76;&#x4E0D;&#x62F7;&#x8D1D;&#x7C7B;&#x5B9A;&#x4E49;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x8C03;&#x7528;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x7CFB;&#x7EDF;&#x4F1A;&#x6839;&#x636E;&#x5B9E;&#x4F8B;&#x7684;isa&#x6307;&#x9488;&#x53BB;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;&#x5217;&#x8868;&#x53CA;&#x7236;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;&#x5217;&#x8868;&#x4E2D;&#x5BFB;&#x627E;&#x4E0E;&#x6D88;&#x606F;&#x5BF9;&#x5E94;&#x7684;selector&#x6307;&#x5411;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x540C;&#x6837;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x6765;&#x770B;&#x4E0B;&#x5176;&#x5B9A;&#x4E49;:</p>
<pre><code>/// Represents an instance of a class.
struct objc_object {
    Class _Nonnull isa  OBJC_ISA_AVAILABILITY;
};
</code></pre><p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x8FD9;&#x4E2A;&#x7ED3;&#x6784;&#x4F53;&#x53EA;&#x6709;&#x4E00;&#x4E2A;isa&#x53D8;&#x91CF;&#xFF0C;&#x6307;&#x5411;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x6240;&#x5C5E;&#x7684;&#x7C7B;&#x3002;&#x4EFB;&#x4F55;&#x5E26;&#x6709;&#x4EE5;&#x6307;&#x9488;&#x5F00;&#x59CB;&#x5E76;&#x6307;&#x5411;&#x7C7B;&#x7ED3;&#x6784;&#x7684;&#x7ED3;&#x6784;&#x90FD;&#x53EF;&#x4EE5;&#x88AB;&#x89C6;&#x4F5C;<code>objc_object</code>, &#x5BF9;&#x8C61;&#x6700;&#x91CD;&#x8981;&#x7684;&#x7279;&#x70B9;&#x662F;&#x53EF;&#x4EE5;&#x7ED9;&#x5176;&#x53D1;&#x9001;&#x6D88;&#x606F;. NSObject&#x7C7B;&#x7684;<code>alloc</code>&#x548C;<code>allocWithZone:</code>&#x65B9;&#x6CD5;&#x4F7F;&#x7528;&#x51FD;&#x6570;<code>class_createInstance</code>&#x6765;&#x521B;&#x5EFA;<code>objc_object</code>&#x6570;&#x636E;&#x7ED3;&#x6784;&#x3002;</p>
<p>&#x53E6;&#x5916;&#x6211;&#x4EEC;&#x5E38;&#x89C1;&#x7684;id&#x7C7B;&#x578B;&#xFF0C;&#x5B83;&#x662F;&#x4E00;&#x4E2A;<code>objc_object</code>&#x7ED3;&#x6784;&#x7C7B;&#x578B;&#x7684;&#x6307;&#x9488;&#x3002;&#x8BE5;&#x7C7B;&#x578B;&#x7684;&#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x8F6C;&#x6362;&#x4E3A;&#x4EFB;&#x4F55;&#x4E00;&#x79CD;&#x5BF9;&#x8C61;&#xFF0C;&#x7C7B;&#x4F3C;&#x4E8E;C&#x8BED;&#x8A00;&#x4E2D;<code>void *</code>&#x6307;&#x9488;&#x7C7B;&#x578B;&#x7684;&#x4F5C;&#x7528;&#x3002;&#x5176;&#x5B9A;&#x4E49;&#x5982;&#x4E0B;&#x6240;&#x793A;:</p>
<pre><code>/// A pointer to an instance of a class.
typedef struct objc_object *id;
</code></pre><h3 id="&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><a name="&#x5143;&#x7C7B;&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x5143;&#x7C7B;&#x5BF9;&#x8C61;" class="plugin-anchor" href="#&#x5143;&#x7C7B;&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5143;&#x7C7B;&#x5BF9;&#x8C61;</h3>
<p>&#x5143;&#x7C7B;(Metaclass)&#x5C31;&#x662F;&#x7C7B;&#x5BF9;&#x8C61;&#x7684;&#x7C7B;&#xFF0C;&#x6BCF;&#x4E2A;&#x7C7B;&#x90FD;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x5143;&#x7C7B;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;<code>objc_class</code>&#x7ED3;&#x6784;&#x4F53;&#x91CC;&#x9762;isa&#x6307;&#x9488;&#x6240;&#x6307;&#x5411;&#x7684;&#x7C7B;. Objective-C&#x7684;&#x7C7B;&#x65B9;&#x6CD5;&#x662F;&#x4F7F;&#x7528;&#x5143;&#x7C7B;&#x7684;&#x6839;&#x672C;&#x539F;&#x56E0;&#xFF0C;&#x56E0;&#x4E3A;&#x5176;&#x4E2D;&#x5B58;&#x50A8;&#x7740;&#x5BF9;&#x5E94;&#x7684;&#x7C7B;&#x5BF9;&#x8C61;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x5373;&#x7C7B;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#x7531;&#x4E0A;&#x56FE;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x5728;&#x7ED9;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x6216;&#x7C7B;&#x5BF9;&#x8C61;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x65F6;&#xFF0C;&#x5BFB;&#x627E;&#x65B9;&#x6CD5;&#x5217;&#x8868;&#x7684;&#x89C4;&#x5219;&#x4E3A;:</p>
<ul>
<li>&#x5F53;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x7ED9;&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x6D88;&#x606F;&#x662F;&#x5728;&#x5BFB;&#x627E;&#x8FD9;&#x4E2A;&#x5BF9;&#x8C61;&#x7684;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;&#x5217;&#x8868;(&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;)</li>
<li>&#x5F53;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x7ED9;&#x7C7B;&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x6D88;&#x606F;&#x662F;&#x5728;&#x5BFB;&#x627E;&#x8FD9;&#x4E2A;&#x7C7B;&#x7684;&#x5143;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;&#x5217;&#x8868;(&#x7C7B;&#x65B9;&#x6CD5;)</li>
</ul>
<p>&#x5143;&#x7C7B;&#xFF0C;&#x5C31;&#x50CF;&#x4E4B;&#x524D;&#x7684;&#x7C7B;&#x4E00;&#x6837;&#xFF0C;&#x5B83;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x6240;&#x4EE5;&#x8FD9;&#x5C31;&#x610F;&#x5473;&#x7740;&#x5B83;&#x5FC5;&#x987B;&#x4E5F;&#x6709;&#x4E00;&#x4E2A;&#x7C7B;&#x3002;&#x6240;&#x6709;&#x7684;&#x5143;&#x7C7B;&#x90FD;&#x4F7F;&#x7528;&#x6839;&#x5143;&#x7C7B;&#x4F5C;&#x4E3A;&#x4ED6;&#x4EEC;&#x7684;&#x7C7B;&#x3002;&#x6BD4;&#x5982;&#x6240;&#x6709;NSObject&#x7684;&#x5B50;&#x7C7B;&#x7684;&#x5143;&#x7C7B;&#x90FD;&#x4F1A;&#x4EE5;NSObject&#x7684;&#x5143;&#x7C7B;&#x4F5C;&#x4E3A;&#x4ED6;&#x4EEC;&#x7684;&#x7C7B;&#x3002;</p>
<p>&#x6839;&#x636E;&#x8FD9;&#x4E2A;&#x89C4;&#x5219;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x5143;&#x7C7B;&#x4F7F;&#x7528;&#x6839;&#x5143;&#x7C7B;&#x4F5C;&#x4E3A;&#x4ED6;&#x4EEC;&#x7684;&#x7C7B;&#xFF0C;&#x6839;&#x5143;&#x7C7B;&#x7684;&#x5143;&#x7C7B;&#x5219;&#x5C31;&#x662F;&#x5B83;&#x81EA;&#x5DF1;&#x3002;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x57FA;&#x7C7B;&#x7684;&#x5143;&#x7C7B;&#x7684;isa&#x6307;&#x9488;&#x6307;&#x5411;&#x4ED6;&#x81EA;&#x5DF1;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3.html" class="navigation navigation-prev " aria-label="Previous page: 3、Runtime">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="3.2.html" class="navigation navigation-next " aria-label="Next page: 3.2消息传递机制">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.1对象、类对象、元类对象","level":"1.4.1","depth":2,"next":{"title":"3.2消息传递机制","level":"1.4.2","depth":2,"path":"md/runtime/3.2.md","ref":"md/runtime/3.2.md","articles":[]},"previous":{"title":"3、Runtime","level":"1.4","depth":1,"path":"md/runtime/3.md","ref":"md/runtime/3.md","articles":[{"title":"3.1对象、类对象、元类对象","level":"1.4.1","depth":2,"path":"md/runtime/3.1.md","ref":"md/runtime/3.1.md","articles":[]},{"title":"3.2消息传递机制","level":"1.4.2","depth":2,"path":"md/runtime/3.2.md","ref":"md/runtime/3.2.md","articles":[]},{"title":"3.3消息转发流程","level":"1.4.3","depth":2,"path":"md/runtime/3.3.md","ref":"md/runtime/3.3.md","articles":[]},{"title":"3.4Method-Swizzling","level":"1.4.4","depth":2,"path":"md/runtime/3.4.md","ref":"md/runtime/3.4.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","github","github-buttons","donate","sharing-plus","anchor-navigation-ex","favicon","livereload"],"styles":{"website":"./styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"github":{"url":"https://github.com/zhou415770319"},"livereload":{},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"../../img/alipay.JPG","alipayText":" ","button":"赞赏","title":"","wechat":"","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"zhou415770319","repo":"iosKnowledges","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"theme":"default","author":"zhoufei","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"zhoufei-iosknowledges","language":"zh-hans","links":{"sidebar":{"我的博客":"http://www.feiyum.cn/index/"}},"gitbook":"3.2.3","description":"ios面试知识点总结"},"file":{"path":"md/runtime/3.1.md","mtime":"2019-05-03T14:40:51.318Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-03T14:51:39.741Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

